﻿{extend name="layout/layout" /}
<!--请在下方写此页面body相关内容-->
{block name="container"}
<div class="page-container">
    <form action="<?php echo url('system/log')?>" method="post">
        <div class="text-c">
			<select class="select-box" style="width: auto;padding: 5px 5px;" size="1" name="type">
				<option value="">日志类型</option>
                <?php foreach($category as $v){?>
				<option value="<?php echo $v['id']?>" <?php if(isset($params['type']) && $params['type'] == $v['id']) echo 'selected';?>><?php echo $v['category_name']?></option>
                <?php }?>
			</select>
            时间：
            <input type="text" name="start_time" value="<?php echo isset($params['start_time']) ? $params['start_time'] : ''?>" onfocus="WdatePicker()" id="datemin" class="input-text Wdate" style="width:120px;"/>
            至
            <input type="text" name="end_time" value="<?php echo isset($params['end_time']) ? $params['end_time'] : ''?>"   onfocus="WdatePicker()" id="datemax" class="input-text Wdate" style="width:120px;"/>
            <input type="text" name="search_name" value="<?php echo isset($params['search_name']) ? $params['search_name'] : ''?>" class="input-text" style="width:250px" placeholder="输入标题、操作人、IP"/>
            <button type="submit" class="btn btn-success radius"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
        </div>
    </form>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="r">共有记录：<strong><?php echo isset($list) ? $list->total() : 0;?></strong> 条</span>
	</div>
	<table class="table table-border table-bordered table-hover table-bg table-sort mt-10">
		<thead>
			<tr class="text-c">
				<th width="50">ID</th>
                <th width="70">日志类型</th>
                <th width="100">日志标题</th>
                <th>日志内容</th>
				<th width="70">操作人</th>
				<th width="120">客户端IP</th>
				<th width="120">时间</th>
				<th width="70">操作</th>
			</tr>
		</thead>
		<tbody>
		<?php if (isset($list)) { foreach($list->items() as $v){?>
			<tr class="text-c">
				<td><?php echo $v['id']?></td>
                <td><?php echo $v['category_name']?></td>
                <td><?php echo $v['title']?></td>
                <td><?php echo empty($v['desc']) ? '-' : (mb_strlen($v['desc'],'utf-8') > 50 ? mb_substr($v['desc'],0,50).'...' : $v['desc'])?></td>
				<td><?php echo $v['username']?></td>
				<td><?php echo long2ip($v['uip'])?></td>
				<td><?php echo date('Y-m-d H:i:s',$v['create_time'])?></td>
                <td><a title="详情" href="javascript:;" onclick="show('日志详情','<?php echo url('system/logShow',array('id' => $v['id']))?>','','500')"><i class="Hui-iconfont">&#xe665;</i></a></td>
			</tr>
		<?php } } if (isset($list) && empty($list->items())) {?>
        <tr class="text-l"><td colspan="20">没有找到匹配的记录</td></tr>
        <?php }?>
		</tbody>
	</table>
    <span class="r pages mt-10"><?php echo isset($list) ? $list->render() : '';?></span>
</div>
{/block}
<!--请在上方写此页面body相关内容-->

<!--请在下方写此页面业务相关的脚本-->
{block name="js"}
<script type="text/javascript">

</script>
{/block}
<!--/请在上方写此页面业务相关的脚本-->